package org.aplikator.client.descriptor;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.aplikator.client.widgets.FormWidget;
import org.aplikator.client.widgets.FunctionButtonWidget;

import com.google.gwt.user.client.ui.Widget;

@SuppressWarnings("serial")
public class FunctionDTO extends ClientDescriptorBase implements Cloneable, WidgetDTO {

    private List<PropertyDTO<? extends Serializable>> properties = new ArrayList<PropertyDTO<? extends Serializable>>();

    @SuppressWarnings("unused")
    private FunctionDTO() {
    }

    public FunctionDTO(String id, String localizedName) {
        super(id, localizedName);
    }

    public List<PropertyDTO<? extends Serializable>> getProperties() {
        return properties;
    }

    public FunctionDTO addProperty(PropertyDTO<? extends Serializable> property) {
        properties.add(property);
        return this;
    }

    public Widget getWidget(FormWidget form) {
        FunctionButtonWidget button = new FunctionButtonWidget(this, form);
        return button;
    }

}
